package com.aishua.fire.common;

/**
 * Created by zhouwei on 2018/8/23.
 */
public class JsonObjectResult<T> {
    private int code;

    private String message;

    private T data;
    
    public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}
	
    public static <K> JsonObjectResult<K> makeSuccessResult(K data) {
        JsonObjectResult<K> result = new JsonObjectResult<>();
        result.setCode(0);
        result.setMessage("");
        result.setData(data);
        return result;
    }

	public static <K> JsonObjectResult<K> makeErrorResult(String msg) {
        JsonObjectResult<K> result = new JsonObjectResult<>();
        result.setCode(1);
        result.setMessage(msg);
        return result;
    }
    
}
